cmake_minimum_required(VERSION 3.16)

project(qml_filedialog VERSION 1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Quick)

qt_standard_project_setup(REQUIRES 6.5)

set(PROJECT_SOURCES
    main.cpp
)

qt_add_executable(qml_filedialog
    ${PROJECT_SOURCES}
)

qt_add_qml_module(qml_filedialog
    URI qml_filedialog
    VERSION 1.0
    QML_FILES
        Main.qml
        components/ImageFileDialog.qml
        components/MultiFileDialog.qml
        components/SaveFileDialog.qml
        components/SimpleFileDialog.qml
)

target_link_libraries(qml_filedialog PRIVATE
    Qt6::Quick
)

set_target_properties(qml_filedialog PROPERTIES
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE TRUE
)

include(GNUInstallDirs)
install(TARGETS qml_filedialog
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
